home *** CD-ROM | disk | FTP | other *** search
/ Hackers Handbook - Millenium Edition / Hackers Handbook.iso / files / exploits / toolscan.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-19  |  2.5 KB  |  116 lines

  1. /*
  2.  
  3.    [ http://www.rootshell.com/ ]
  4.  
  5.    Black Angel proudly presents :
  6.    ------------------------------
  7.  
  8.    TOOLTALK-RPC Scanner V1.1
  9.  
  10.    Syntax :
  11.  
  12.    ./toolscan 195.3.90.2 196.0.0.0 [1]
  13.  
  14.    ^          ^          ^
  15.    |          |          |
  16.    Start-IP   End-IP  ToolTalk-RPC Version
  17.  
  18.    If you don't specify any version number, the program will scan for any 
  19.    version. I really don't know whether there are any versions beside the vulnerable
  20.    version 1, so I included this little feature (sorry for this lack of knowledge).
  21.  
  22.    What it does :
  23.  
  24.    Concerning 'CERT CA-98.11 tooltalk' there is a overflow in the tooltalk database
  25.    server - runing root, which allows an attacker to gain access. This little scanner
  26.    scans for this RPC-service.
  27.  
  28.  
  29.    Have fun !
  30.  
  31.  
  32.    PS : Use this program at your own risk.
  33.  */
  34.  
  35. #include <sys/types.h>
  36. #include <sys/param.h>
  37. #include <sys/socket.h>
  38. #include <netdb.h>
  39. #include <stdio.h>
  40. #include <getopt.h>
  41. #include <string.h>
  42. #include <rpc/rpc.h>
  43. #include <rpc/pmap_clnt.h>
  44. #include <arpa/inet.h>
  45. #include <utmp.h>
  46. #include <stdlib.h>
  47.  
  48. #define TOOLTALK_RPC 100083
  49.  
  50.  
  51. main (int argc, char *argv[])
  52. {
  53.   long counter;
  54.   struct in_addr addr;
  55.   unsigned long start;
  56.   unsigned long end;
  57.  
  58.  
  59.   int version = -1;
  60.  
  61.  
  62.   printf ("Black Angel's ToolTalk RPC Scanner V1.1 9/1998 :\n");
  63.   printf ("See CERT CA-98.11 tooltalk for more information\n");
  64.   printf ("E-Mail : b_angel98@yahoo.com - [ http://www.rootshell.com/ ]\n\n");
  65.  
  66.  
  67.   if (argc == 4)
  68.     {
  69.       version = atoi (argv[3]);
  70.     }
  71.   else
  72.     {
  73.       if (argc != 3)
  74.     {
  75.       printf ("\nusage : %s start-ip-address  end-ip-address [RPC_VERSION]\n\n", argv[0]);
  76.       exit (0);
  77.     }
  78.     }
  79.  
  80.   start = inet_addr (argv[1]);
  81.   end = inet_addr (argv[2]);
  82.  
  83.   for (counter = ntohl (start); counter <= ntohl (end); counter++)
  84.     {
  85.       if ((counter & 0xff) == 255)
  86.     counter++;
  87.       if ((counter & 0xff) == 0)
  88.     counter++;
  89.  
  90.       addr.s_addr = htonl (counter);
  91.  
  92.       if (version == -1)
  93.     {
  94.       if (callrpc (inet_ntoa (addr), TOOLTALK_RPC, version, 0,
  95.                (xdrproc_t) xdr_void, (caddr_t) NULL,
  96.                (xdrproc_t) xdr_void, (caddr_t) NULL) == 9)
  97.         {
  98.  
  99.           fprintf (stdout, "Found ToolTalk : %s\n", inet_ntoa (addr));
  100.           fflush (stdout);
  101.         }
  102.     }
  103.       else
  104.     {
  105.       if (callrpc (inet_ntoa (addr), TOOLTALK_RPC, version, 0,
  106.                (xdrproc_t) xdr_void, (caddr_t) NULL,
  107.                (xdrproc_t) xdr_void, (caddr_t) NULL) == 0)
  108.         {
  109.  
  110.           fprintf (stdout, "Found ToolTalk Version %d : %s\n", version, inet_ntoa (addr));
  111.           fflush (stdout);
  112.         }
  113.     }
  114.     }
  115. }
  116.